package com.lanyou.esb.cook.proxy.meta;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 运行环境 <br>
 * 描述：<br>
 * 1:正式环境；2:测试环境
 * 
 * @author Davey.wu
 */
public enum Environment {
	PRODUCTION("1"), TEST("2");
	public final String ValueCode;

	private Environment(String code) {
		this.ValueCode = code;
	}

	public static Environment get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isBlank(valueCode)) {
			throw new NullPointerException();
		}
		for (Environment type : Environment.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
